package libcore.util;

import android.text.TextUtils;
import android.widget.Toast;
import androidx.annotation.StringRes;
import libcore.config.LibConfig;

public class ToastUtil {

  public static void toast(String toast) {
    if (!TextUtils.isEmpty(toast)) {
      Toast.makeText(LibConfig.getContext(), toast, Toast.LENGTH_SHORT).show();
    }
  }

  public static void toast(@StringRes int id) {
    Toast.makeText(LibConfig.getContext(), LibConfig.getContext().getString(id),
      Toast.LENGTH_SHORT)
      .show();
  }

  public static void toast(String format, Object... args) {
    if (!TextUtils.isEmpty(format)) {
      Toast.makeText(LibConfig.getContext(), String.format(format, args), Toast.LENGTH_SHORT)
        .show();
    }
  }
}
